package com.example.oop.POJO;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "chat")
public class Chat {
    @Id
    private Integer id;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date chatTime;

    private String content;

    @ManyToOne
    @JoinColumn(name = "chat_send_id")
    private ChatRoom sendChatRoom;

    @ManyToOne
    @JoinColumn(name = "chat_receive_id")
    private ChatRoom receiveChatRoom;
}
